package com.obsidian.content.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.obsidian.content.entity.CourseBase;
import com.obsidian.content.model.CourseBaseParam;
import com.obsidian.content.model.PageParams;
import com.obsidian.content.model.PageResult;
import com.obsidian.content.model.dto.QueryCourseParamsDto;
import com.obsidian.content.service.ICourseBaseService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 课程基本信息 前端控制器
 * </p>
 *
 * @author jianghao
 * @date 2023-02-06
 */
@RestController
@RequestMapping("/content")
public class CourseBaseController {

    @Resource
    private ICourseBaseService courseBaseService;

    @PostMapping("/course/list")
    public PageResult<CourseBase> list(PageParams pageParams, @RequestBody QueryCourseParamsDto dto) {
        return courseBaseService.queryCourseBaseList(pageParams, dto);
    }

    @PostMapping("/course/listPage/{currentPage}/{currentSize}")
    public Page<CourseBase> listPage(@Validated @RequestBody CourseBaseParam courseBaseParam, @PathVariable int currentPage, @PathVariable int currentSize) {
        return courseBaseService.lisePage(courseBaseParam, currentPage, currentSize);
    }

}
